class code3 {
    //找出所有子集的异或总和再求和
    int sum = 0;
    int path;
    public int subsetXORSum(int[] nums) {
        dfs(nums,0);
        return sum;
    }
    public void dfs(int[] nums,int pos) {
        sum += path;
        for(int i=pos;i<nums.length;i++) {
            path^= nums[i];
            dfs(nums,i+1);
            path^= nums[i];//回溯
        }
    }
}